package com.gaofans.nrpc.common.processor;

import reactor.core.publisher.FluxSink;

import java.util.Objects;

/**
 * @author GaoFans
 */
public class MultiSink<T> implements Sink<T>{

    private final FluxSink<T> sink;
    public MultiSink(FluxSink<T> sink) {
        this.sink = Objects.requireNonNull(sink);
    }

    @Override
    public Sink<T> next(T t) {
        return new MultiSink<>(sink.next(t));
    }

    @Override
    public void complete() {
        sink.complete();
    }

    @Override
    public void error(Throwable throwable) {
        sink.error(throwable);
    }
}
